package io.renren.modules.hos.controller;

import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;
import io.renren.modules.hos.entity.MedicineEntity;
import io.renren.modules.hos.service.DoctorService;
import io.renren.modules.hos.service.MedicineService;
import io.renren.modules.hos.vo.DoctorVo;
import io.renren.modules.hos.vo.MedicineVo;
import io.renren.modules.hos.vo.params.SearchParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping("hos/search")
public class SearchController {
    @Autowired
    private MedicineService medicineService;
    @Autowired
    private DoctorService doctorService;

    /**
     * 搜索药品
     */
    @PostMapping("/medicine")
    public R searchMedicine(@RequestBody SearchParam searchParam){
        PageUtils page = medicineService.search(searchParam);

        return R.ok().put("page", page);
    }

    /**
     * 搜索医生
     * @param searchParam
     * @return
     */
    @PostMapping("/doctor")
    public R searchDoctor(@RequestBody SearchParam searchParam){
        PageUtils page = doctorService.searchByName(searchParam);

        return R.ok().put("page", page);
    }
}
